
package org.apache.ocean;

import org.apache.ocean.*;
import org.apache.commons.lang.*;

/**
 *
 * @author jasonr
 */
public class TransactionRecordRequest {
  public String shardID;
  public TransactionID transactionID;

  public TransactionRecordRequest(String shardID, TransactionID transactionID) {
    this.shardID = shardID;
    this.transactionID = transactionID;
  }
  
  public static TransactionRecordRequest parse(String string) {
    String[] array = StringUtils.split(string, ":");
    String shardID = array[0];
    TransactionID transactionID = TransactionID.parse(array[1]);
    return new TransactionRecordRequest(shardID, transactionID);
  }
  
  public String toString() {
    String transactionIDString = transactionID.toString();
    StringBuilder builder = new StringBuilder(shardID.length()+1+transactionIDString.length());
    builder.append(shardID);
    builder.append(":");
    builder.append(transactionIDString);
    return builder.toString();
  }
  
  public TransactionRecordRequest() {
  }
}
